Ext.define('AmpleHarvest.objects.Statistics.view.pages.cPopularity',
{
	extend			: 'AmpleHarvest.objects.Statistics.absPanel',

	title			: 'Source List',
	layout			:
	{
		type	: 'vbox',
		align	: 'stretch'
	},
	frame			: true,
	initComponent	: function()
	{
		this.setStore(Ext.create(
				'AmpleHarvest.DATA.Store.statistics.pages.cHitCount',
				{
					pageSize	: 25
				}
		));
		
		this.getStore().sort('value', 'DESC');
		
		this.m_obj_Pageing = Ext.create('Ext.toolbar.Paging',
				{
					xtype		: 'pagingtoolbar',
					store		: this.getStore(),
					dock		: 'bottom',
					displayInfo	: true
				});

		this.m_obj_Grid = Ext.create('Ext.grid.Panel',
				{
					store		: this.getStore(),
					flex		: 1,
					columns		:
					[
							{
								header		: 'Page ID',
								dataIndex	: 'id',
								flex		: 1
							},
							{
								header		: 'Last Hit',
								dataIndex	: 'datetime',
								flex		: 1
							},
							{
								header		: 'Total Hits',
								dataIndex	: 'value',
								flex		: 1
							}
					],
					dockedItems	:
					[
						this.m_obj_Pageing
					]
				});

		this.callParent();
		this.getStore().on("beforeload", this.showMask, this);
		this.getStore().on("load", this.hideMask, this);

		this.on("render", this.updateData, this);

		this.m_obj_Grid.on('itemdblclick', this.on_DblClick, this);

		this.add(this.m_obj_Grid);
	},

	on_DblClick		: function(obj_View, obj_Rec, obj_HTML, int_Index,
			obj_Event, obj_Options)
	{
		m_obj_AmpleHarvest_ViewPort
				.fireEvent(
						AmpleHarvest.eventHandler.cWindowEvents.C_STR_EVENT_ARTICLE_OPEN,
						obj_Rec.get("group")
				);
	}

}
);